package com.yuyu.commons.constant;

import java.util.Objects;

public enum IndexEnum {
    Person(1,"person");

    private Integer type;
    private String index;


    IndexEnum(int type, String index) {
        this.type=type;
        this.index=index;
    }

    public static IndexEnum getInstance(Integer type){
        for (IndexEnum value : values()) {
            if (Objects.nonNull(type) && type.equals(value.getType())){
                return value;
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public String getIndex() {
        return index;
    }
}
